﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace UniSender.Test
{
    public class TestExportResult
    {
        string exportJSON;

        public TestExportResult()
        {
            exportJSON = new System.IO.StreamReader(
                this.GetType().Assembly.GetManifestResourceStream("UniSender.Test.Resources.export.json")
            ).ReadToEnd();
        }

        [Fact]
        public void TestNativeResultParsing()
        {
            var client = new ClientStub();
            var r = new Deserializer().Deserialize<Native.Response<Native.ExportResult>>(exportJSON);
            Assert.NotNull(r);
            Assert.NotNull(r.result);
            Assert.Equal(7, r.result.field_names.Length);
            Assert.Equal(3, r.result.data.Length);
            Assert.Equal(7, r.result.data[0].Length);
        }
    }
}
